# -*- coding: utf-8 -*-

import scrapy

class IndexSpider(scrapy.Spider):
    name = "words"
    start_urls = [
        'https://www.baidu.com/',
    ]
    # def start_requests(self):
    #     return [scrapy.FormRequest("http://www.vxinghe.com/",
    #                                formdata={'user': 'john', 'pass': 'secret'},
    #                                callback=self.logged_in)]
    # def logged_in(self, response):
    #     print("哈哈哈哈哈哈")

    def parse(self, response):
        for i in (1,1,1,1):
            print("0000000000000")
        basePath = '//ul[@class="s-news-rank-content"]'
        titlePath = './/li/a/text()'
        for quote in response.xpath(basePath):
            item = {
                'title': quote.xpath(titlePath).extract_first()
            }
            yield item
        # next_page_url = response.xpath('//li[@class="next"]/a/@href').extract_first()
        # if next_page_url is not None:
        #     yield scrapy.Request(response.urljoin(next_page_url))



